# Maintainer: Hoang Nguyen <folliekazetani@protonmail.com>
pkgname=py3-gitlab
_pyname=${pkgname/py3/python}
pkgver=3.6.0
pkgrel=0
pkgdesc="Python wrapper for Gitlab's API"
url="https://github.com/python-gitlab/python-gitlab"
arch="noarch"
license="LGPL-3.0-or-later"
depends="python3 py3-requests py3-requests-toolbelt"
makedepends="
	py3-setuptools
	py3-build
	py3-installer
	py3-wheel
	py3-sphinx
	py3-sphinxcontrib-autoprogram
	py3-myst-parser
	"
checkdepends="py3-pytest py3-responses"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/python-gitlab/python-gitlab/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 -m build --no-isolation --wheel
	sphinx-build -W -b man docs/ man/
}

check() {
	sed -i "s|/usr/bin/false|/bin/false|g" tests/unit/test_config.py

	# Functional tests need docker
	# Smoke tests fail on executing setup.py
	python3 -m pytest --ignore=tests/functional/ --ignore=tests/smoke/test_dists.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		dist/python_gitlab-$pkgver-py3-none-any.whl
	install -Dm644 man/$_pyname.1 \
		"$pkgdir"/usr/share/man/man1/$_pyname.1
}

sha512sums="
c28b211bc63cbb3eee1df250fdadce0d7ed076dfe46cdc27f8eb1214275a43fa7bd8c261a37892ea0246cf7b0dcfb9cd453ff82a0b25e0b9e8860acbf7c4dd7c  py3-gitlab-3.6.0.tar.gz
"
